package cn.lil.servlet;

import cn.lil.dao.UserDao;
import cn.lil.model.User;
import cn.lil.service.UserService;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.sql.SQLException;

@WebServlet(name = "UserGetUserUpdate", value = "/UserGetUserUpdate")
public class UserGetUserUpdate extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int id = Integer.parseInt(request.getParameter("id"));
        System.out.println(id);
        UserDao userDao = new UserDao();
        UserService userService = new UserService();
        userService.getUserUpdate(id);
        request.setAttribute("id", id);
        RequestDispatcher dispatcher = request.getRequestDispatcher("/updateUser.jsp");
        dispatcher.forward(request, response);
    }
}
